﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM.HTML
{
    #region Using Statements

    using System;

    #endregion

    /// <summary>
    /// Provides a caption for a FIELDSET grouping. 
    /// See the LEGEND element definition in HTML 4.01.
    /// </summary>
    public class HTMLLegendElement : HTMLFormElementBase
    {
        #region Using Statements

        internal HTMLLegendElement(Document owner)
            : base(owner, HTMLConstants.HTML_TAG_LEGEND)
        {
        }

        #endregion

        #region DOM Level 2 HTML Compliance

        /// <summary>
        /// A single character access key to give access to the form control.
        /// See the accesskey attribute definition in HTML 4.01.
        /// </summary>
        public string accessKey
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_ACCESSKEY);
            }
            set
            {
                if (value.Length == 0)
                    removeAttribute(HTMLConstants.HTML_ATT_ACCESSKEY);
                else
                    setAttribute(HTMLConstants.HTML_ATT_ACCESSKEY, value);
            }
        }

        /// <summary>
        /// Text alignment relative to FIELDSET. See the align attribute 
        /// definition in HTML 4.01. This attribute is deprecated in HTML 4.01.
        /// </summary>
        public string align
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_ALIGN);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(HTMLConstants.HTML_ATT_ALIGN);
                else
                    setAttribute(HTMLConstants.HTML_ATT_ALIGN, value);
            }
        }

        #endregion
    }
}
